package com.youlu.campus.web.community.controller;


import com.youlu.campus.entity.VO.req.ActivityCultureCreativeReq;
import com.youlu.campus.service.item.ActivityCultureCreativeConfigService;
import com.youlu.campus.service.item.ItemInfoService;
import com.youlu.campus.web.common.base.RequestContext;
import com.yuelin.infrastructure.quantum.common.QResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 文创商品控制器
 */
@RestController
public class ActivityCultureCreativeController {

    @Autowired
    private ItemInfoService itemInfoService;

    @Autowired
    private ActivityCultureCreativeConfigService activityCultureCreativeConfigService;

    /**
     * 活动文创的栏目商品列表
     *
     * @param cultureCreativeReq
     * @return
     */
    @PostMapping("/mini-app/culture-creative/query")
    public QResult list(@RequestBody ActivityCultureCreativeReq cultureCreativeReq) {
        return QResult.success(activityCultureCreativeConfigService.index(cultureCreativeReq));
    }

    /**
     * 商品详情
     *
     * @param id
     * @return
     */
    @GetMapping("/mini-app/culture-creative/detail")
    public QResult cultureCreativeDetail(String id) {
        return QResult.success(itemInfoService.detailCultureCreative(RequestContext.getAppId(),
                RequestContext.getCurPlatform(), id, RequestContext.getUserId()));
    }

    /**
     * 文创的栏目商品列表
     *
     * @param cultureCreativeReq
     * @return
     */
    @PostMapping("/mini-app/item/list")
    public QResult itemList(@RequestBody ActivityCultureCreativeReq cultureCreativeReq) {
        return QResult.success(activityCultureCreativeConfigService.getItemList(cultureCreativeReq));
    }


}
